<template>
    <div class="Child">
        <h2>子组件1</h2>
        <h3>玩具：{{ toy }}</h3>
        <h3>书：{{ book }}本</h3>
        <button @click="minusHouse($parent)">减少父组件的1套房产</button>
    </div>
</template>

<script lang="ts" setup name="Child1">
    import {ref} from "vue"
    //数据
    let toy = ref("奥特曼")
    let book = ref(4)
    //方法
    function minusHouse(parent:any){
        parent.house -= 1
    }

    defineExpose({toy,book})
</script>

<style scoped>
.Child{
    background-color: orange;
    width: 1000px;
    height: 200px;
}
</style>